#!/usr/bin/env -S sh
length=$(vlc.do -c get_length);
time=$(vlc.do -c get_time);
title=$(vlc.do -c get_title);
oldtitle=$title;

. vlc.getsock.sh

while [ isrunning ]
do
	title=$(vlc.do -c get_title);
	echo "new$title";
	oldtitle=$title;
	echo "old$oldtitle";
	length=$(vlc.do -c get_length);
	(
		while [ $time -lt $length ]
		do
			title=$(vlc.do -c get_title);
			if [ "$oldtitle" != "$title" ]
			then
				break 2;
			fi
			time=$(vlc.do -c get_time);
			echo $time;
		done
	) | Xdialog --auto-placement --title "$title" --icon ~/.icewm/icons/media-cdrom.xpm --progress "$title" 0 0 $length;
done
